//
//  DXMLPersonObject.m
//  DerbyStatter
//
//  Created by glenn andreas on 1/6/14.
//  Copyright (c) 2014 glenn andreas. All rights reserved.
//

#import "DXMLPersonObject.h"

@implementation DXMLPersonObject
DXMLSTRINGATTR(name, Name)
DXMLSTRINGATTR(number, Number)
@end


@implementation NSString(StatsBookRosterDoc)
- (BOOL) isValidWFTDANumber
{
    if (self.length < 1 || self.length > 4)
        return NO;
    // use simple character by character checks instead of a heavier weight
    // character set approach
    for (NSInteger i=0;i<self.length;i++) {
        unichar c = [self characterAtIndex:i];
        if ('0' <= c && c <= '9')
            continue;
        else if ('A' <= c && c <= 'Z')
            continue;
        else if ('a' <= c && c <= 'z')
            continue;
        else
            return NO;
    }
    return YES;
}

@end